CAPI=2:
# Copyright lowRISC contributors (OpenTitan project).
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
name: ${instance_vlnv("lowrisc:ip:otp_ctrl:1.0")}
description: "OTP Controller"

filesets:
  files_rtl:
    depend:
      - lowrisc:ip:otp_ctrl_pkg
      - ${instance_vlnv("lowrisc:ip:otp_ctrl_macro_pkg")}
      - ${instance_vlnv("lowrisc:ip:otp_ctrl_top_specific_pkg")}
      - lowrisc:ip:otp_macro_pkg
      - lowrisc:ip:tlul
      - lowrisc:prim:all
      - lowrisc:prim:ram_1p
      - lowrisc:prim:double_lfsr
      - lowrisc:prim:count
      - lowrisc:prim:lc_sender
      - lowrisc:prim:lc_sync
      - lowrisc:prim:buf
      - lowrisc:prim:flop
      - lowrisc:prim:secded
      - lowrisc:prim:edn_req
      - lowrisc:prim:sec_anchor
      # TODO(#27347): prim_pkg is deprecated
      - lowrisc:prim:prim_pkg
      - ${instance_vlnv("lowrisc:ip:pwrmgr_pkg")}
      - lowrisc:ip:edn_pkg
      - lowrisc:prim:sparse_fsm
      - "fileset_partner  ? (partner:systems:ast_pkg)"
      - "!fileset_partner ? (lowrisc:systems:ast_pkg)"
    files:
      - rtl/otp_ctrl_core_reg_top.sv
      - rtl/otp_ctrl_ecc_reg.sv
      - rtl/otp_ctrl_scrmbl.sv
      - rtl/otp_ctrl_lfsr_timer.sv
      - rtl/otp_ctrl_part_unbuf.sv
      - rtl/otp_ctrl_part_buf.sv
      - rtl/otp_ctrl_dai.sv
      - rtl/otp_ctrl_kdi.sv
      - rtl/otp_ctrl_lci.sv
      - rtl/otp_ctrl.sv
    file_type: systemVerilogSource

  files_verilator_waiver:
    depend:
      # common waivers
      - lowrisc:lint:common
      - lowrisc:lint:comportable
    files:
      - lint/otp_ctrl.vlt
    file_type: vlt

  files_ascentlint_waiver:
    depend:
      # common waivers
      - lowrisc:lint:common
      - lowrisc:lint:comportable
    files:
      - lint/otp_ctrl.waiver
    file_type: waiver

  files_veriblelint_waiver:
    depend:
      # common waivers
      - lowrisc:lint:common
      - lowrisc:lint:comportable
    files:
      - lint/otp_ctrl.vbl
    file_type: veribleLintWaiver

parameters:
  SYNTHESIS:
    datatype: bool
    paramtype: vlogdefine


targets:
  default: &default_target
    filesets:
      - tool_verilator   ? (files_verilator_waiver)
      - tool_ascentlint  ? (files_ascentlint_waiver)
      - tool_veriblelint ? (files_veriblelint_waiver)
      - files_rtl
    toplevel: otp_ctrl

  lint:
    <<: *default_target
    default_tool: verilator
    parameters:
      - SYNTHESIS=true
    tools:
      verilator:
        mode: lint-only
        verilator_options:
          - "-Wall"

  syn:
    <<: *default_target
    # TODO: set default to DC once
    # this option is available
    # olofk/edalize#89
    default_tool: icarus
    parameters:
      - SYNTHESIS=true
